package com.changgou.entity;

import com.alibaba.fastjson.annotation.JSONField;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.io.Serializable;

/**
 * MQ消息封装
 *
 * @author gaofeng
 * @date 2025/4/20 21:29
 */
@Setter
@Getter
@NoArgsConstructor
public class Message implements Serializable {
    /**
     * 执行的操作  1：增加，2：修改,3：删除
     */
    private int code;

    /**
     * 数据
     */
    private Object content;

    /**
     * 发送的routeKey
     */
    @JSONField(serialize = false)
    private String routeKey;

    /**
     * 交换机
     */
    @JSONField(serialize = false)
    private String exChange;

    public Message(int code, Object content) {
        this.code = code;
        this.content = content;
    }

    public Message(int code, Object content, String routeKey, String exChange) {
        this.code = code;
        this.content = content;
        this.routeKey = routeKey;
        this.exChange = exChange;
    }
}
